import 'dart:collection';
import 'package:sample2/model/serialize.dart';
import 'package:sample2/model/auth/check_status.dart';
import 'package:sample2/utils/string_util.dart';

class RegisterInfo extends SerializeImp {
  String username = "";
  String? password = "";
  int? age = -1;
  int? gender = -1; //

  RegisterInfo({required this.username, this.password, this.age, this.gender});

  @override
  Map<String, dynamic> toParameters() {
    return HashMap.from({
      "username": username.toString(),
      "password": password!.toString(),
      "gender": gender.toString()
    });
  }

  CheckStatus isValid() {
    if (StringUtil.isNullOrEmpty(username)) {
      return CheckStatus.failureWithMessage("username is invalid");
    }
    return CheckStatus.checkStatusSuccess;
  }
}
